var o = getApp();

Page({
    data: {
        usr: null,
        vendor: {}
    },
    toPage: function(o) {
        var n = o.currentTarget.dataset.url;
        console.log(n), wx.navigateTo({
            url: n
        });
    },
    reload: function() {
        var o = this;
        wx.getStorage({
            key: "usr",
            complete: function(n) {
                o.setData({
                    usr: n.data
                });
            }
        });
    },
    logout: function() {
        var o = this;
        wx.showModal({
            title: "提示",
            content: "确定要退出吗",
            success: function(n) {
                n.confirm && o.doLogout();
            }
        });
    },
    doLogout: function() {
        wx.removeStorageSync("usr"), wx.reLaunch({
            url: "/pages/index/index"
        });
    },
    onLoad: function(n) {
        var t = this;
        this.reload(), o.request({
            url: o.server + "/userApi/getFactoryInfo",
            method: "POST",
            data: {
                token: o.token
            },
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function(o) {
                t.setData({
                    vendor: o.data.result.info
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});